libarchive: Add support for translating paths during commit
authorColin Walters <walters@verbum.org>
Wed, 23 Aug 2017 01:52:24 +0000 (21:52 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Wed, 30 Aug 2017 14:30:30 +0000 (14:30 +0000)
commit138c4d7aaea9956ea686fb8d6fe13557e0ac4d6e
tree8174dba575a296b3871b38b0436103be09088348
parent355e8516b04801caf50b0b8a218fc8f6321d8d05
libarchive: Add support for translating paths during commit

For rpm-ostree, I want to move RPM files in `/boot` to `/usr/lib/ostree-boot`.
This is currently impossible without forking the libarchive code.  Supporting
this is pretty straightforward; we already had pathname translation in
the libarchive code, we just need to expose it as an option.

On the command line side, I chose to wrap this as a regexp. That should be good
enough for a lot of use cases; sophisticated users should as always be making
use of the API. Note that this required some new `#ifdef LIBARCHIVE` bits to use
the new API. Following previous patterns here, we use the new API only if a
relevant option is enabled, ensuring unit test coverage of both paths.

For the test cases, I ended up changing the accounting to avoid having to
multiply the test count.

Closes: #1105
Approved by: jlebon
src/libostree/ostree-libarchive-private.h
src/libostree/ostree-repo-libarchive.c
src/libostree/ostree-repo.h
src/ostree/ot-builtin-commit.c
tests/test-libarchive.sh